x11: round the scaled size *up* when we get a ConfigureNotify
authorOwen W. Taylor <otaylor@fishsoup.net>
Thu, 6 Nov 2014 21:17:33 +0000 (16:17 -0500)
committerAlexander Larsson <alexl@redhat.com>
Thu, 20 Nov 2014 09:19:27 +0000 (10:19 +0100)
Although we specify a resize increment to try and get a size that is
a multiple of the window scale, maximization typically wins
over the resize increment, so the window might be odd sized.

Round *up* in this case, rather than down, since it's better to
truncate a line or two at the bottom and right of the window rather
than have a line or two that we don't know what to do with.

https://bugzilla.gnome.org/show_bug.cgi?id=739750

gdk/x11/gdkdisplay-x11.c

index 2ebbed9953ebb1883e8ade48ab9c6ad89edba4de..d5cf7d666f74399e2de9144a5d26947f32cb087a 100644 (file)
@@ -767,8 +767,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
                           : ""));
       if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
         {
-         window->width = xevent->xconfigure.width / window_impl->window_scale;
-         window->height = xevent->xconfigure.height / window_impl->window_scale;
+         window->width = (xevent->xconfigure.width + window_impl->window_scale - 1) / window_impl->window_scale;
+         window->height = (xevent->xconfigure.height + window_impl->window_scale - 1) / window_impl->window_scale;
 
          _gdk_window_update_size (window);
          _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
@@ -793,8 +793,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
        {
          event->configure.type = GDK_CONFIGURE;
          event->configure.window = window;
-         event->configure.width = xevent->xconfigure.width / window_impl->window_scale;
-         event->configure.height = xevent->xconfigure.height / window_impl->window_scale;
+         event->configure.width = (xevent->xconfigure.width + window_impl->window_scale - 1) / window_impl->window_scale;
+         event->configure.height = (xevent->xconfigure.height + window_impl->window_scale - 1) / window_impl->window_scale;
 
          if (!xevent->xconfigure.send_event &&
              !xevent->xconfigure.override_redirect &&
@@ -826,8 +826,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
            {
              window->x = event->configure.x;
              window->y = event->configure.y;
-             window->width = xevent->xconfigure.width / window_impl->window_scale;
-             window->height = xevent->xconfigure.height / window_impl->window_scale;
+              window->width = event->configure.width;
+              window->height = event->configure.height;
 
              _gdk_window_update_size (window);
              _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));